package com.xuedakun.sample.xasdk.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.xuedakun.sample.xasdk.volley_test.SampleVolleyCallback;
import com.xuedakun.sample.xasdk.volley_test.TestResult;
import com.xuedakun.xasdk.XActivity;
import com.xuedakun.xasdk.XLog;
import com.xuedakun.xasdk.net.volley.GetRequest;
import com.xuedakun.xasdk.net.volley.RequestCallback;

/**
 * Created by xuedakun on 2017/6/3 14:49
 *
 * @version : v1.0
 * @project : xasdk
 * @Email : dakun611@Gmail.com
 */

public class MainActivity extends XActivity{

    private static final String LOG_TAG = "MainActivity";

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        testVolleyRequest();
    }

    public static void testVolleyRequest(){
        new GetRequest<TestResult>("http://api.17daiwa.com", "user/myBabys", new SampleVolleyCallback(TestResult.class))
                .addArgument("token", "c63f6756446e9ace36cb567868ba59ae2437ec15")
                .addArgument("cch", "100002")
                .addArgument("via", 1)
                .addArgument("ver", 1.5)
                .addArgument("devId", 0)
                .execute(new RequestCallback<TestResult>() {
            @Override
            public void onRequestSucceed(TestResult result) {
                XLog.e(LOG_TAG, result.getData().get(0).getAvatar());
            }

            @Override
            public void onRequestFail(TestResult result) {
                XLog.e(LOG_TAG, "-----" + result.getMsg());
            }
        });
    }
}
